<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>商品信息</title>
    <link rel="shortcut icon" href="${pageContext.request.contextPath}/static/img/higou.png" />
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/css/head.css" />
    <script src="${pageContext.request.contextPath}/static/js/jquery-3.3.1.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="${pageContext.request.contextPath}/static/js/bootstrap.min.js" type="text/javascript" charset="utf-8"></script>
</head>
<style type="text/css">
    .good_details{
        width: 900px;
        height: 600px;
        position: relative;
        margin: 0 auto;
        top: 30px;
    }

    .good_details_left,.good_details_right{
        display: inline-block;
        float: left;
        width: 400px;
        height: 600px;
    }
    .good_text{
        font-size: 19px;
        line-height: 1.5;
    }
    .good_price{
        width: 400px;
        height: 50px;
        padding-top: 10px;
        border-bottom: 1px dashed lightgray;
        font-size: 25px;
        color: #ed145b;
    }
    .good_yunfei{
        width: 400px;
        height: 50px;
        margin-top: 20px;
        border-bottom: 1px dashed lightgray;
        color: #999;

    }
    .good_service,.good_num{
        width: 400px;
        height: 50px;
        margin-top: 20px;
        border-bottom: 1px dashed lightgray;
        color: #999;
    }
    .btn-success{
        background: #ed145b;
        color: white;
        width: 400px;
        height: 66px;
        line-height: 66px;
        text-align: center;
        font-size: 33px;
    }
</style>
<body>
<div class="head">
    <div class="head_top">
        <div class="head_top_mid">
            <ul class="head_ul head_ul_left">
                <c:if test="${not empty sessionScope.user}">
                    <li>欢迎 [${sessionScope.user.u_name}] 来到嗨购! <a href="${pageContext.request.contextPath}/exit.jsp">[退出]</a></li>
                </c:if>
                <c:if test="${empty sessionScope.user}">
                    <li>欢迎来到嗨购!</li>
                    <li>
                        <a href="login.jsp">请登录</a>
                    </li>
                    <li>
                        <a href="register.jsp">快速注册</a>
                    </li>
                </c:if>
            </ul>
            <ul class="head_ul head_ul_right">
                <li>
                    <a href="#"><span class="img1"></span>收藏品牌</a>
                </li>
                <li>
                    <a href="${pageContext.request.contextPath}/UserInfoServlet.do">订单查询</a>
                </li>
                <li>正品保证</li>
            </ul>
        </div>
    </div>
    <div class="head_center">
        <div class="logo">

        </div>
        <div class="head_center_mid"><form action="${pageContext.request.contextPath}/SearchGoodsServlet.do" method="post">
            <div class="head_center_mid_left head_center_mid_all">
                <input type="text" name="search" id="search" maxlength="250" required="required"/>
            </div>
            <div class="head_center_mid_right head_center_mid_all">
                <input type="submit" value="搜索" id="ss">
            </div></form>
        </div>
        <div class="cart_box">
            <a href="${pageContext.request.contextPath}/SearchCarServlet.do">
                <div class="cart_box_img">
                    <img src="static/img/cart.gif" width="28px" height="28px" />
                </div>
                <span style="">
								去购物车结算
							</span>
            </a>
        </div>
    </div>
    <div class="head_bot">
        <div class="head_bot_mid">
            <div class="head_bot_mid_nav" style="background: #ed145b;">
                <a href="index.jsp">首页</a>
            </div>
            <div class="head_bot_mid_nav">
                <a href="${pageContext.request.contextPath}/SearchKindServlet.do?k_name=女装">女装</a>
            </div>
            <div class="head_bot_mid_nav">
                <a href="${pageContext.request.contextPath}/SearchKindServlet.do?k_name=男装">男装</a>
            </div>
            <div class="head_bot_mid_nav">
                <a href="${pageContext.request.contextPath}/SearchKindServlet.do?k_name=运动户外">运动户外</a>
            </div>
            <div class="head_bot_mid_nav">
                <a href="${pageContext.request.contextPath}/SearchKindServlet.do?k_name=家居用品">家居用品</a>
            </div>
            <div class="head_bot_mid_nav">
                <a href="${pageContext.request.contextPath}/SearchKindServlet.do?k_name=医疗保健">医疗保健</a>
            </div>

            <div class="head_bot_right">
                <img src="static/img/z_01new.jpg" />
                <img src="static/img/z02.jpg" />
                <img src="static/img/z03.jpg" />
                <span></span>
            </div>
        </div>

    </div>
</div>
<div class="good_details">
    <div class="good_details_left">
        <img src="${pageContext.request.contextPath}/static/img/goods/${sessionScope.goodMap.g_img}.jpg" width="350px" height="500px"/>
    </div>
    <div class="good_details_right">
        <div class="good_text">${sessionScope.goodMap.g_info}</div>
        <div class="good_price">
            ￥${sessionScope.goodMap.g_now*sessionScope.goodMap.e_dis}
        </div>
        <div class="good_yunfei">
            运费: 本商品单件包邮
        </div>
        <div class="good_service">
            服务: <span style="color: black;">质量保险 | 本商品支持7天无条件退货  |<br />
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;本商品不支持换货 | 闪电发货</span>
        </div>
        <div class="good_num" id="good_num">
            库存数量:${sessionScope.goodMap.g_num}
        </div>
        <button type="submit" class="btn-success" id="joinCar">加入购物车</button>
    </div>
</div>

<div class="footer">
    <div class="footer_logo">

    </div>
</div>
</body>
<script>
    $(document).ready(function(){
        jQuery("#joinCar").click(function () {
            jQuery.ajax({
                url:"${pageContext.request.contextPath}/JoinCarServlet.do",
                data:{"g_id":${sessionScope.goodMap.g_id},"num":1},
                type:"post",
                dataType:"json",
                success:function (data) {
                    jQuery("#good_num").html("库存数量:"+data.g_num);
                }
            })
            alert("加入购物车成功");
        })
    })
</script>
</html>
